<template>
	<gui-page :customHeader="false">
		<view slot="gBody" class="gui-flex1">
			<view class="gui-padding">
				<view v-for="(item,index) in list" :key='item.id' class="gui-list-items my-color specil" @tap="tiao(item.id)">
					<view class="gui-list-body gui-border-b">
						<view class="gui-list-title">
							<text class="gui-list-title-text">{{item.title}}</text>
							<text class="gui-list-arrow-right gui-icons">&#xe601;</text>
						</view>
					</view>
				</view>
				<!-- #ifdef APP-PLUS -->
				<view  @tap="update" class="gui-list-items my-color specil">
					<view class="gui-list-body gui-border-b">
						<view class="gui-list-title">
							<text class="gui-list-title-text">升级</text>
							<text class="gui-list-arrow-right gui-icons">&#xe601;</text>
						</view>
					</view>
				</view>
				<!-- #endif -->
			</view>
			<view class="ucenter-line"></view>
			<view @tap="logout"  hover-class="gui-tap">
				<text class="gui-text-center gui-block-text gui-icons logoff gui-color-gray">&#xe62e; 退出登录</text>
			</view>
			<view class="ucenter-line"></view>
		</view>
	</gui-page>
</template>
<script>
let graceJS = require('@/lizhili/js/grace.js');
let common = require('@/common.js');
import autoUpdater from '@/components/autoUpdater.min.js';
export default {
	data() {
		return {
			list:[]
		}
	},
	onShow:function(){
		uni.common.post(
			uni.common.apiServer + 'index',
			{
				type: 'get_xiangguan_list',
			},
			false,
			res => {
				if (res.code == 1) {
					this.list=res.data
				}
			},
			e => {
				console.log(e);
			}
		);
	},
	methods:{
		update(){
			uni.common.post(
				uni.common.apiServer + 'index',
				{
					type: 'update_app',
				},
				false,
				res => {
					if (res.code == 1) {
						if (res.app_v > plus.runtime.versionCode) {
							
							autoUpdater.init({
								packageUrl: res.url,
								content: res.desc,
								contentAlign: 'left',
								cancel: '取消该版本',
								cancelColor: '#007fff'
							});
							autoUpdater.show();
							
						}
					}else{
							uni.showToast({
								icon:'none',
								title:'最新版本无需升级！'
							})
						}
				},
				e => {
					console.log(e);
				}
			);
		},
		tiao(type){
			uni.navigateTo({
				url:'../index/web?src='+type
			})
		},
		
		logout(){
			try {
				uni.clearStorageSync();
			} catch (e) {
				// error
			}
			uni.reLaunch({
			    url: '/pages/index/index'
			});
		},
	}
}
</script>
<style>
	.gui-header{background-color: #ECECEC;}
	.gui-header-content{margin-right: 0;}
	.ucenter-line{background-color:#F6F7F8;width: 100%;height: 16rpx;}
	.menu-items{width:100rpx; height:100rpx; margin:20rpx 0; border-radius:100rpx;}
	.menu-icon{width:100rpx; line-height:40rpx; font-size:36rpx;}
	.menu-text{width:100rpx; line-height:30rpx; font-size:22rpx;}
	.my-size{font-size: 42rpx;}
	.my-size1{font-size: 54rpx;}
	.my-right{margin-right: 20rpx;}
	.my-img{width: 80rpx;height: 80rpx;overflow: hidden;border-radius: 15rpx;}
	.my-yuan{background-color: #fa5251;width: 50rpx;height:50rpx;border-radius: 50%;text-align: center;color: #FFFFFF;}
	.my-left{margin-left: 390rpx;}
	.specil image{width: 40rpx;margin-left: 20rpx;margin-right: 20rpx;}
	.gui-list-title-text{font-size: 32rpx;}
	.logoff{line-height:88rpx; font-size:28rpx;}
</style>